/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chalmers.se.tda367.utils;

import java.io.File;
import javax.swing.ImageIcon;

/**
 *
 * @author malinanker
 */
public class ImageFilterUtils {

    public final static String jpeg = "jpeg";
    public final static String jpg = "jpg";
    public final static String tiff = "tiff";
    public final static String gif = "gif";
    public final static String tif = "tif";
    public final static String png = "png";

    public static String getExtension(File file) {
        String temp = null;
        String s = file.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 && i < s.length() - 1) {
            temp = s.substring(i + 1).toLowerCase();
        }
        return temp;
    }

    public static ImageIcon createImageIcon(String path) {
        java.net.URL url = ImageFilterUtils.class.getResource(path);
        return new ImageIcon(url);
    }
}
